<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActiveSupport::Multibyte::Unicode::UnicodeDatabase</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActiveSupport::Multibyte::Unicode::UnicodeDatabase 
            
                <span class="parent">&lt; 
                    
                    <a href="../../../Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../../../files/activesupport/lib/active_support/multibyte/unicode_rb.html">activesupport/lib/active_support/multibyte/unicode.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>Holds static data from the <a href="../Unicode.html">Unicode</a> database.</p>

    </div>
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="UnicodeDatabase.html#method-i-3D-3D-3D">===</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="UnicodeDatabase.html#method-c-dirname">dirname</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>F</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="UnicodeDatabase.html#method-c-filename">filename</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>L</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="UnicodeDatabase.html#method-i-load">load</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="UnicodeDatabase.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    
      <!-- Section constants -->
      <div class="sectiontitle">Constants</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class="attr-name">ATTRIBUTES</td>
            <td>=</td>
            <td class="attr-value">:codepoints, :composition_exclusion, :composition_map, :boundary, :cp1252</td>
          </tr>
          
            <tr valign='top'>
              <td>&nbsp;</td>
              <td colspan="2" class="attr-desc"></td>
            </tr>
          
        
      </table>
    


    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-dirname">
            
              <b>dirname</b>()
            
            <a href="UnicodeDatabase.html#method-c-dirname" name="method-c-dirname" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the directory in which the data files are stored.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-dirname_source')" id="l_method-c-dirname_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/65bf0945ee84c9e16865f1d49fa678e930fc33f6/activesupport/lib/active_support/multibyte/unicode.rb#L363" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-dirname_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/multibyte/unicode.rb, line 363</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">dirname</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>) <span class="ruby-operator">+</span> <span class="ruby-string">'/../values/'</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-filename">
            
              <b>filename</b>()
            
            <a href="UnicodeDatabase.html#method-c-filename" name="method-c-filename" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Returns the filename for the data file for this version.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-filename_source')" id="l_method-c-filename_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/65bf0945ee84c9e16865f1d49fa678e930fc33f6/activesupport/lib/active_support/multibyte/unicode.rb#L368" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-filename_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/multibyte/unicode.rb, line 368</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">self</span>.<span class="ruby-identifier">filename</span>
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dirname</span>, <span class="ruby-string">&quot;unicode_tables.dat&quot;</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>()
            
            <a href="UnicodeDatabase.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/65bf0945ee84c9e16865f1d49fa678e930fc33f6/activesupport/lib/active_support/multibyte/unicode.rb#L320" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/multibyte/unicode.rb, line 320</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>
  <span class="ruby-ivar">@codepoints</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Codepoint</span>.<span class="ruby-identifier">new</span>)
  <span class="ruby-ivar">@composition_exclusion</span> = []
  <span class="ruby-ivar">@composition_map</span> = {}
  <span class="ruby-ivar">@boundary</span> = {}
  <span class="ruby-ivar">@cp1252</span> = {}
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-3D-3D-3D">
            
              <b>===</b>(other)
            
            <a href="UnicodeDatabase.html#method-i-3D-3D-3D" name="method-i-3D-3D-3D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-3D-3D-3D_source')" id="l_method-i-3D-3D-3D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/65bf0945ee84c9e16865f1d49fa678e930fc33f6/activesupport/lib/active_support/multibyte/unicode.rb#L350" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-3D-3D-3D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/multibyte/unicode.rb, line 350</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">===</span>(<span class="ruby-keyword ruby-title">other</span>)
  <span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">other</span> } <span class="ruby-operator">?</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-load">
            
              <b>load</b>()
            
            <a href="UnicodeDatabase.html#method-i-load" name="method-i-load" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Loads the <a href="../Unicode.html">Unicode</a> database and returns all
the internal objects of <a href="UnicodeDatabase.html">UnicodeDatabase</a>.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-load_source')" id="l_method-i-load_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/65bf0945ee84c9e16865f1d49fa678e930fc33f6/activesupport/lib/active_support/multibyte/unicode.rb#L340" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-load_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/multibyte/unicode.rb, line 340</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">load</span>
  <span class="ruby-keyword">begin</span>
    <span class="ruby-ivar">@codepoints</span>, <span class="ruby-ivar">@composition_exclusion</span>, <span class="ruby-ivar">@composition_map</span>, <span class="ruby-ivar">@boundary</span>, <span class="ruby-ivar">@cp1252</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">filename</span>, <span class="ruby-string">'rb'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">read</span> }
  <span class="ruby-keyword">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Couldn't load the Unicode tables for UTF8Handler (#{e.message}), ActiveSupport::Multibyte is unusable&quot;</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># Redefine the === method so we can write shorter rules for grapheme cluster breaks</span>
  <span class="ruby-ivar">@boundary</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">_</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@boundary</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">def</span> <span class="ruby-operator">===</span>(<span class="ruby-keyword ruby-title">other</span>)
        <span class="ruby-identifier">detect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">other</span> } <span class="ruby-operator">?</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@boundary</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
  <span class="ruby-keyword">end</span>

  <span class="ruby-comment"># define attr_reader methods for the instance variables</span>
  <span class="ruby-keyword">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword ruby-title">self</span>
    <span class="ruby-identifier">attr_reader</span>(*<span class="ruby-constant">ATTRIBUTES</span>)
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    